<!--
描述：办公自动化-应聘人员管理-新增组件
开发人：hqj
开发日期：2017年10月30日
-->

<template lang="pug">
  kalix-dialog.user-add(bizKey="org" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="机构代码" prop="code" v-bind:label-width="labelWidth")
        el-input(v-model="formModel.code" disabled)
      el-form-item(label="机构名称" prop="name" v-bind:rules="rules.name" v-bind:label-width="labelWidth")
        el-input(v-model="formModel.name")
      el-form-item(label="所属校区" prop="szxqid" v-bind:label-width="labelWidth")
        kalix-object-select2(v-model="formModel.szxqid" v-bind:objectsUrl="schoolZoneURL" v-bind:label="'zwmc'")
</template>

<script type="text/ecmascript-6">
import FormModel from './model'
import {orgURL, schoolZoneURL} from '../../config.toml'

export default {
  name: 'AdminOrgEdit',
  data() {
    return {
      orgName: '',
      formModel: Object.assign({}, FormModel),
      rules: {
        name: [{required: true, message: '请输入组织机构名称', trigger: 'blur'}]
      },
      targetURL: orgURL,
      schoolZoneURL: schoolZoneURL,
      labelWidth: '120px'
    }
  },
  methods: {
    init(dialogOption, row) {
      // console.log('[kalix-vue-admin] oreEdit.vue function init.')
      // console.log('dialogOption:', dialogOption)
      // console.log('row:', row)
      // setTimeout(() => {
      //   this.formModel.orgName = row.name
      //   this.formModel.parentId = row.id
      // }, 1000)
    }
  }
}
</script>
